Skip to content

macOS compile modkit - v0.6.3#619

Open
SuhasSrinivasan wants to merge 17 commits into
nanoporetech:masterfrom
SuhasSrinivasan:0.6.3-mac_compile
Open

macOS compile modkit - v0.6.3#619
SuhasSrinivasan wants to merge 17 commits into
nanoporetech:masterfrom
SuhasSrinivasan:0.6.3-mac_compile

Conversation

@SuhasSrinivasan
Copy link
Copy Markdown
Contributor

  1. Updated help markdown in book/src/mac_compile_modkit.md
  2. No MPS support and no Python and PyTorch dependencies are the default build options
  3. If MPS support is needed user can run MODKIT_MPS_SUPPORT=1 bash mac_compile_modkit.sh
  4. Installs Xcode Command Line Tools
  5. Installs Homebrew package manager
  6. Considers uv and pyenv through config (if MODKIT_MPS_SUPPORT=1)
  7. Installs rustup (Rust toolchain installer)
  8. Installs Rust compiler (rustc) and Cargo build tool
  9. Clones the modkit GitHub repository
  10. Checks out the latest release version
  11. Creates a Python virtual environment (if MODKIT_MPS_SUPPORT=1)
  12. Installs PyTorch in the virtual environment (if MODKIT_MPS_SUPPORT=1)
  13. Sets and verifies environment variables for libtorch (if MODKIT_MPS_SUPPORT=1)
  14. Verifies modkit binary is working and prints installation info

…c and the verbose echo line are gone; no trace remains.

MODKIT_MPS_SUPPORT added (default 0):

Documented in the file header, print_usage(), and the config section
Validated at the top of main() (rejects anything other than 0 or 1)
Controls all MPS-specific behaviour throughout
main() — resolve_python_toolchain, create_venv, install_pytorch are now inside if [[ "${MODKIT_MPS_SUPPORT}" == "1" ]]. The header summary only prints Python controls when MPS is enabled.

setup_environment_variables() — split into two branches:

MPS=1: full existing behaviour (LIBTORCH vars, venv activation, path verification), but without RAYON
MPS=0: generates a slim setup_modkit_env.sh that only exports PATH and no sourcing/libtorch verification happens
build_modkit() — uses --features accelerate,tch (MPS=1) or --features accelerate (MPS=0); step title, GPU Support field, and troubleshooting tips all reflect the active mode.

save_installation_info() — always writes paths/versions/quick-start; Python/PyTorch/venv fields and run examples only appended when MPS=1; Runtime Threading section removed.

macOS version check — the strict 12.3 requirement is now gated on MODKIT_MPS_SUPPORT=1, so users on earlier macOS can still do a no-MPS build.
Copilot AI review requested due to automatic review settings May 22, 2026 05:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a macOS (Apple Silicon) install/compile path for modkit via a new automation script and accompanying documentation, aiming to make MPS (Metal) GPU-enabled builds opt-in.

Changes:

  • Added mac_compile_modkit.sh to automate dependency installation, repo checkout, optional Python/PyTorch setup, and building modkit.
  • Added mdBook documentation page and nav entry describing macOS compilation and MPS/Python controls.
  • Updated README.md to point users to the new macOS compilation path.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
README.md Adds a macOS (Apple Silicon) section pointing to the new script and guide.
mac_compile_modkit.sh New end-to-end macOS installer/compiler script with optional MPS/PyTorch support.
book/src/SUMMARY.md Adds the new macOS compilation page to the mdBook navigation.
book/src/mac_compile_modkit.md New documentation page explaining script usage, options, and troubleshooting.
Comments suppressed due to low confidence (2)

mac_compile_modkit.sh:819

  • Same issue as above: in a sourced script $0 refers to the parent shell, so the usage guidance is inaccurate. Prefer ${BASH_SOURCE[0]} (or equivalent) for usage text in this generated script.
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
    echo "Error: This script must be sourced, not executed."
    echo "Usage: source ${0} <installation_directory> [--verbose]"
    exit 1

book/src/mac_compile_modkit.md:150

  • These MPS rebuild instructions use cargo build --features accelerate,tch from the repo root, but the workspace root is a virtual manifest and the modkit package itself doesn't define these features. As written, this command will fail. Please update to the correct build invocation for this workspace that produces an MPS-enabled open-chromatin build.
source ~/tools/setup_modkit_env.sh ~/tools
cd ~/tools/modkit
cargo clean
cargo build --release --features accelerate,tch
</details>



---

💡 <a href="/nanoporetech/modkit/new/master?filename=.github/instructions/*.instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Add Copilot custom instructions</a> for smarter, more guided reviews. <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn how to get started</a>.

Comment thread mac_compile_modkit.sh Outdated
Comment thread mac_compile_modkit.sh
Comment thread mac_compile_modkit.sh
Comment thread mac_compile_modkit.sh
Comment thread mac_compile_modkit.sh
Comment thread mac_compile_modkit.sh
Comment thread README.md
Comment thread README.md
Comment thread book/src/mac_compile_modkit.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants